mixin nav(currentPath, navItems, title, headings)
  ul.category-content
    if navItems
      +navRec(currentPath, navItems, title, 2)

mixin navRec(currentPath, navItems, title, depth)
  for navItem in navItems
    - var isCurrentFile = navItem.path === currentPath;
    - var className = ['sidebar-element', ('level-h' + depth), (isCurrentFile ? 'navItem-active' : 'navItem')];
    - var activeClass = isCurrentFile ? 'navItem-active' : '';
    li(class=className)
      a(href=navItem.path class=activeClass)=navItem.title
      if navItem.metadata.source
        span
          |  -
          a(href=navItem.metadata.source) source code
